.<template>
  <div class="w100 h100">
    <div class="input">
      <van-icon
        @click="back"
        name="arrow-left"
        size="40"
        color="rgb(132, 131, 129)"
      />
      <input
        v-model="inp"
        @keyup.enter="search"
        class="inp"
        type="text"
        placeholder="搜索"
      />
    </div>
    <div class="history w100">
      <div class="history1">
        <p style="font-size: 0.4rem">历史搜索</p>
        <img
          @click="del"
          src="https://lanhu.oss-cn-beijing.aliyuncs.com/ps74cdlygmwb7jkkko1v1w9yh285w29l4e052c3fb-275a-4710-909d-d7d3b2919a1d"
        />
      </div>
      <ul class="w100 wu">
        <p v-show="value.length == 0">暂无搜索记录</p>
        <li v-for="(v, index) in value" :key="index">
          {{ v }}
        </li>
      </ul>
    </div>
    <div class="w100 fire">
      <p>热门搜索</p>
      <ul>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      inp: "",
      value: [],
    };
  },
  methods: {
    search() {
      if (this.inp != "") {
        this.value.unshift(this.inp);
        this.inp = "";
      }
    },
    back() {
      this.$router.back();
    },
    del() {
      this.value = [];
    },
  },
};
</script>

<style scoped>
.input {
  width: 100%;
  height: 1rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: rgb(237, 236, 236);
}
.inp {
  width: 84%;
  height: 0.7rem;
  font-size: 0.4rem;
  text-align: center;
  border: none;
}
.history {
  height: 2rem;
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.history1 {
  width: 90%;
  display: flex;
  justify-content: space-between;
}
.wu {
  height: 1rem;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  overflow: hidden;
}
.wu p {
  font-size: 0.3rem;
}
.fire {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fire p {
  width: 90%;
  font-size: 0.4rem;
}
.fire ul {
  width: 90%;
}
.fire ul li {
  width: 100%;
  height: 0.5rem;
  background-color: blue;
  margin-top: 0.2rem;
}
</style>